use criterion::{black_box, criterion_group, criterion_main, Criterion};
use compare_pointer::compare_pointer;

fn bench_compare_pointer_pointer_equal(c: &mut Criterion) {
    let ptr1 = &1 as *const i32 as *const ();
    let ptr2 = &2 as *const i32 as *const ();
    let ptr3 = ptr1;

    c.bench_function("compare_pointer_pointer_equal", |b| {
        b.iter(|| {
            black_box(compare_pointer::pointer_equal(ptr1, ptr2));
            black_box(compare_pointer::pointer_equal(ptr1, ptr3));
        })
    });
}

fn bench_compare_pointer_pointer_compare(c: &mut Criterion) {
    let ptr1 = &1 as *const i32 as *const ();
    let ptr2 = &2 as *const i32 as *const ();
    let ptr3 = ptr1;

    c.bench_function("compare_pointer_pointer_compare", |b| {
        b.iter(|| {
            black_box(compare_pointer::pointer_compare(ptr1, ptr2));
            black_box(compare_pointer::pointer_compare(ptr1, ptr3));
        })
    });
}

criterion_group!(
    benches,
    bench_compare_pointer_pointer_equal,
    bench_compare_pointer_pointer_compare
);
criterion_main!(benches);